package net.huashitong.Indicators.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.Indicators.dao.TwoIndexDao;
import net.huashitong.Indicators.entity.TwoIndex;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TwoIndexService extends StringPKService<TwoIndex> {

    @Autowired
    private SysTableService tabservice;
    @Autowired
    private TwoIndexDao dao;

    @Override
    protected BaseDao<TwoIndex, String> getDao() {
        return dao;
    }

    @Override
    protected void beforeSave(TwoIndex obj) {
        obj.setSysId(tabservice.updateMaxSysId( "AB02",null));
    }

    public List<TwoIndex> queryByParentCode(String parentCode){
        return dao.queryByParentCode(parentCode);
    }
}
